using WMS.FC.Domain.DomainObject.System;
using WMS.FC.Infrastructure.Register;

var builder = WebApplication.CreateBuilder(args);

builder.RegisterAutoFac();

var wmsSettings = builder.Configuration.GetSection(WmsSettings.KEY).Get<WmsSettings>();

builder.RegisterCros(wmsSettings);

builder.RegisterEFCore(wmsSettings);

builder.RegisterSerilog(wmsSettings);

builder.RegisterSwagger(Path.GetDirectoryName(typeof(Program).Assembly.Location)!);

builder.Services.AddAutoMapper(typeof(AutoMapperRegister));

builder.Services.Configure<WmsSettings>(builder.Configuration.GetSection(WmsSettings.KEY));

builder.Services.AddHttpClient();

builder.Services.AddControllers().RegisterJson();

builder.Services.AddEndpointsApiExplorer();

var app = builder.Build();

app.UseSwagger();
app.UseSwaggerUI();

app.UseCors("allowOrigins");

app.MapControllers();

app.Run();
